<template>
  <div>
    <div class="home">
        <div class="bottom" v-if="Object.keys(info).length > 0">
<div class="mylist" :style="{ 'background-image':`url('${info[$store.state.language].appointment_info_pic}')` }">
            </div>

            <!-- <div class="mylist"><img class="list" :src="info[$store.state.language].appointment_info_pic" alt=""></div> -->


            <div class="number">
                <p class="name">{{ $t('queryList.code') }}</p>
                <p class="content">{{ info[$store.state.language].num }}</p>
            </div>
            <!-- <div><hr></div> -->
            <div class="time">
                <p class="name">{{ $t('queryList.time') }}</p>
                <p class="content">
                    {{ info[$store.state.language].dates }}<br>
                    {{ info[$store.state.language].times }}
                </p>
            </div>
            <div class="address">
                <p class="name">{{ $t('queryList.place') }}</p>
                <p class="content">{{ info[$store.state.language].address }}</p>
            </div>
            <div class="rule">
                <p class="name">{{ $t('queryList.rules') }}</p>
                
                <p class="content" v-html="info[$store.state.language].rule"></p>
               
            </div>
        </div>
         
    </div>
    <div class="box" v-if="boxShow">
        <div v-if="ok" class="box_yes hairlines">
            <div class="small">贝浩登&nbsp;PERROTIN</div>
            <div class="end"><div>{{ $t('orderNono') }}</div></div>
        </div>
    </div>    
  </div>
</template>

<script>
export default {
  // name: "home"
  components: {},
  data() {
    return {
      boxShow: false,
      ok: false,
      info: {},
      mypic:
        "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2254957257,3668952885&fm=26&gp=0.jpg"
    };
  },
  methods: {
    getOrderMessage(tel) {
      this.$http
        .get("/getAppointment", {
          params: {
            tel: tel
          }
        })
        .then(response => {
          if (response.data == 0 || response.data == 4) {
            this.boxShow = true;
            this.ok = true;
            var that = this;
            setTimeout(function() {
              that.boxShow = false;
              that.$router.push("/reservation");
            }, 3000);
          } else {
            this.info = response.data;
          }
        })
        .catch(function(response) {
          console.log(response);
        });
    }
  },
  created() {
    this.getOrderMessage(this.$route.params.tel);
    // this.getOrderMessage();
  }
};
</script>
<style lang="scss" scoped>
.ignore {
  border-bottom: 1px solid black;
}
.hairlines {
  border: 1px solid black;
}
.box {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0px;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  .box_yes {
    width: 184px;
    height: 134px;
    border-radius: 6px;
    background-color: white;
    display: flex;
    flex-flow: column;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    .small {
      width: 100%;
      height: 22px;
      background-color: black;
      color: white;
      font-size: 12px;
      line-height: 22px;
    }
    .end {
      flex: 1;
      padding: 0 10px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
.home {
  width: 100%;
  // height: 100vh;
  display: flex;
  flex-flow: column;

  .bottom {
    flex: 1;
    width: 100%;
    position: relative;
    font-size: 14px;
    // top: 53px;
    .mylist {
      width: 345px;
      margin-top: 15px;
      background-repeat: no-repeat !important;
      background-position: center center !important;
      background-size: cover !important;
      height: 180px;
      position: relative;
      left: 15px;
      img {
        width: 100%;
        height: 100%;
      }
    }

    .number {
      width: 300px;
      height: 40px;
      display: flex;
      flex-flow: wrap;
      justify-content: center;
      align-items: center;
      padding-left: 37.5px;
      margin-top: 20px;
      margin-bottom: 10px;
      .name {
        width: 60%;
        font-weight: bold;
      }
      .content {
        flex: 1;
      }
    }
    .time {
      width: 300px;
      height: 40px;
      display: flex;
      //   flex-flow: wrap;
      justify-content: center;
      align-items: center;
      padding-left: 37.5px;
      justify-content: center;
      align-items: center;
      margin-bottom: 10px;
      .name {
        width: 60%;
        font-weight: bold;
      }
      .content {
        flex: 1;
        line-height: 20px;
      }
    }
    .address {
      width: 300px;
      height: 40px;
      display: flex;
      flex-flow: wrap;
      justify-content: center;
      align-items: center;
      padding-left: 37.5px;
      margin-bottom: 10px;
      .name {
        width: 60%;
        font-weight: bold;
      }
      .content {
        flex: 1;
      }
    }
    .rule {
      width: 300px;
      margin-bottom: 20px;
      display: flex;
      flex-flow: column;
      justify-content: center;
      padding-left: 37.5px;
      margin-bottom: 10px;
      .name {
        width: 60%;
        font-weight: bold;
        margin-bottom: -10px;
      }
      .content {
        flex: 1;
        font-size: 15px;
        line-height: 23px;
        // text-align: justify;
        // text-justify: inter-character;
      }
    }
  }
}
</style>

